/*=====================================================================

  File:      cleanup.sql
  Summary:   SQL script to remove the db3d database if present
  Date:	     September 7, 2006

---------------------------------------------------------------------

  This file is part of the Microsoft SQL Server Code Samples.
  Copyright (C) Microsoft Corporation.  All rights reserved.

This source code is intended only as a supplement to Microsoft
Development Tools and/or on-line documentation.  See these other
materials for detailed information regarding Microsoft code samples.

THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

======================================================= */


IF EXISTS (SELECT [name] FROM [master].[sys].[databases] WHERE [name] = N'db3d')
    DROP DATABASE [db3d];

-- If the database has any other open connections close the network connection.
IF @@ERROR = 3702 
    RAISERROR('[db3d] database cannot be dropped because there are still other open connections', 127, 127) WITH NOWAIT, LOG;
GO